package cn.com.my.yzt;

import java.util.ArrayList;
import java.util.List;

public class ListMain {

	public static void main(String[] args) {
	/*	List<Object> param = new ArrayList<Object>();
		param.add(1);param.add(2);param.add(3);
		int size = param.size();
		param.remove(size-1);
		param.add(100);
		
		for(Object i : param){
			System.out.println(i);
		}*/
		
		Double x = new Double(1.56);
		System.out.println(x);
		
		System.out.println(yuanToFee(String.valueOf(x)));
	}

	
	/** 
	 * 将元为单位的数额转换为分 
	 * @param amount 
	 * @return 
	 */  
	 public static Long yuanToFee(String amount){      
	        String currency =  amount.replaceAll("\\$|\\￥|\\,", "");  //处理包含, ￥ 或者$的金额      
	        int index = currency.indexOf(".");      
	        int length = currency.length();      
	        Long amLong = 0l;      
	        if(index == -1){      
	            amLong = Long.valueOf(currency+"00");      
	        }else if(length - index >= 3){      
	            amLong = Long.valueOf((currency.substring(0, index+3)).replace(".", ""));      
	        }else if(length - index == 2){      
	            amLong = Long.valueOf((currency.substring(0, index+2)).replace(".", "")+0);      
	        }else{      
	            amLong = Long.valueOf((currency.substring(0, index+1)).replace(".", "")+"00");      
	        }      
	        return amLong;      
	  } 
}
